#!/usr/bin/python
#  encoding=utf8
from subprocess import Popen, PIPE
def invoke_ping(addr):
    # windows 的参数和linux下不同
    cmd = ['ping', '-n', '1', addr]
    ret = 0
    try:
        ret = Popen(cmd, bufsize=1024, stdout=PIPE)
    except ValueError:
        print 'error occur in invoke_ping: ' + addr
    return ret
l = []
res = invoke_ping('10.10.6.223')
echo = res.communicate()[0].split('\n')
ttl_pos = echo[2].find('TTL')
if ttl_pos != -1:
    ms_pos = echo[2].find('ms')
    i = ms_pos - 1
    while i > 0 and echo[2][i:i+1].isdigit() == True:
        i -= 1
    ti = int(echo[2][i+1:ms_pos])
    ttl = int(echo[2][ttl_pos + 4:])

print ti,  ttl